2 + 35
Hello! You’ve successfully opened this Jupyter Notebook in Google Colab. Congrats!
Throughout the club, we will use pink & green sticky notes to keep tabs on how everyone is doing. If at any time you want help from a facilitator, put your pink sticky note on your laptop like this:
Don’t hesitate to ask for help if you get stuck, have a question, or something just doesn’t make sense. We’re here to help you!
When you reach the end of this practice notebook, put up your green sticky note so the facilitators know you’ve finished. A green sticky means “Everything is working great!”
A Jupyter Notebook is a file that lets us run code and see the output right below it. Every chunk of code is called a cell. You can run a code cell by pressing the play button next to it. Hover your mouse over the brackets in cell below (or click on the cell) and press the play button to the left to see what happens!
Isn’t that cool? Python did the math for us and showed us the answer. Like many programming languages, you can use Python just like a calculator.
You can create new code cells by pressing the button + Code in the upper left corner of the toolbar. (Hint: first select the cell you want the new one to appear beneath.)
Try it here! Create a new code cell and add two numbers together.
Sometimes we want to write a comment inside a code cell as a note to our future selves or other coders, but we don’t want Python to interpret the comment as code. Code is meant to be read by computers and humans, while comments are meant to be read by humans only. You can begin a line with the hash symbol (#) so Python will know it’s a comment, like this:
# this line is a comment. It doesn't get run as code
11 + 23 # the first part of this line is code, but everything after # is a comment34
Throughout the Lessons and Practices you will see code cells that begin with a comment that instructs you to do something, and a blank line below it where you should write code – like this:
Besides addition with the plus symbol (+), Python can do lots of other operations including subtraction (-), multiplication (*), and division (/).
Practice using them below!
Next week, we’ll continue to practice using Python as a calculator and learn how to reuse the results.
We can use text cells (this is one!) to write descriptions of what our code does, why we wrote it, and ideas for future work. We can use underscores (_) to make text italicized and double asterisks (**) to make text bold. We can also make a bulleted list using dashes - with one item on each line: - item 1 - item 2 - item 3
Press the button + Text in the toolbar to create a new text cell below this one. Then, write a list of 3 things you’re looking forward to about this club. Make the one you’re most excited about bold. Share your answer with your neighbor!
Here, students should have written what they’re looking forward to in the GWC club.
You can move cells around to change the order in the notebook by pressing the arrow buttons in the upper right corner of the cell. Try moving the cells below so that they’re in ascending order.
This is cell 1 (it should be first)
This is cell 2 (it should be second)
This is cell 3 (it should be third)
Throughout the club, be sure to save your notebooks so you can access your work later! To save a notebook, press Copy to Drive in the upper left corner. Once you’ve copied a notebook to Google Drive, you can use the keyboard shortcut Ctrl + S to save it again as you make changes and write new code.
Save this notebook if you haven’t already!
Now let’s make sure you have access to your Jupyter notebooks. Go to your Google Drive and open the folder Colab Notebooks. There should be a copy of this notebook – double-click it and select Open with Google Colaboratory. You should see all of your work in it.
If you’ve gotten to this point and everything worked, put up your green sticky note. If you run into any problems, put up your pink sticky note and a facilitator will come help.